<?php
namespace PsiFramework\Classes\Util\HTTP;

import("Classes.Util.HTTP.Request");

use \PsiFramework\Classes\Util\HTTP\Request;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * The RedirectionManager class is used to redirect pages
 *
 * @package Util.HTTP
 */
class RedirectionManager
{

    protected static /*RedirectionManager*/ $_singleton ;

    protected /*Request*/ $_request ;

    protected function __construct()
    {
        $this->_request = Request::getInstance();
    }

    public function redirect($link=null)
    {
        header('Location: ' . $link);
    }

    /**
     * This function must be called instead of the construtor
     *
     * @return RedirectionManager instance
     */
    public static function getInstance()
    {

        if (self::$_singleton == null) {
            self::$_singleton = new RedirectionManager();
        }

        return self::$_singleton;
    }
}
